package Reflection;

import org.junit.Test;

//通过反射创建对应的运行时类的对象
public class Demo2 {
    @Test
    public void test1() throws Exception{
        Class<Person> clazz = Person.class;
        //通过newInstance创建对应的运行时类的对象
        //调用空参构造器造对象
        //空参构造器的访问权限要满足，通常为public
        Person p = (Person) clazz.newInstance();
        System.out.println(p);
    }

}
